/** @type {import('next').NextConfig} */
const path = require('path');

const nextConfig = {
  reactStrictMode: false, // 关闭严格模式以避免开发时的双重渲染
  transpilePackages: ['../../core', '../../adapters/next'],
  webpack: (config, { isServer }) => {
    // 解决 Next.js 中导入项目外部模块的问题
    config.resolve.symlinks = false;
    
    // 添加别名，方便导入
    config.resolve.alias = {
      ...config.resolve.alias,
      '@core': path.resolve(__dirname, '../../core'),
      '@adapters': path.resolve(__dirname, '../../adapters'),
    };
    
    // 确保正确处理 .js 文件作为 ESM
    config.module.rules.push({
      test: /\.js$/,
      include: [
        path.resolve(__dirname, '../../core'),
        path.resolve(__dirname, '../../adapters')
      ],
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['next/babel'],
        },
      },
    });
    
    return config;
  },
  // 禁用 ESLint 检查，避免构建错误
  eslint: {
    ignoreDuringBuilds: true,
  },
};

module.exports = nextConfig; 